home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / AIncludes / WorldScript.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  9.1 KB  |  274 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        WorldScript.a
  3. ;
  4. ;    Contains:    WorldScript I Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1994-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__WORLDSCRIPT__') = 'UNDEFINED' THEN
  18. __WORLDSCRIPT__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__TRAPS__') = 'UNDEFINED' THEN
  24.     include 'Traps.a'
  25.     ENDIF
  26.     IF &TYPE('__QUICKDRAWTEXT__') = 'UNDEFINED' THEN
  27.     include 'QuickdrawText.a'
  28.     ENDIF
  29.  
  30. ; typedef UInt16                         WSIOffset
  31.  
  32. ; typedef UInt8                         WSIByteCount
  33.  
  34. ; typedef UInt8                         WSIByteIndex
  35.  
  36. ;  offset from start of sub-table to row in state table 
  37. ; typedef UInt16                         WSIStateOffset
  38.  
  39. ; typedef UInt32                         WSITableOffset
  40.  
  41. ; typedef UInt16                         WSISubtableOffset
  42.  
  43. ; typedef UInt16                         WSIGlyphcode
  44.  
  45. ; typedef UInt32                         WSITableIdentifiers
  46.  
  47.  
  48. kScriptSettingsTag                EQU        'info'
  49. kMetamorphosisTag                EQU        'mort'
  50. kGlyphExpansionTag                EQU        'g2g#'
  51. kPropertiesTag                    EQU        'prop'
  52. kJustificationTag                EQU        'kash'
  53. kCharToGlyphTag                    EQU        'cmap'
  54. kGlyphToCharTag                    EQU        'pamc'
  55. kFindScriptRunTag                EQU        'fstb'
  56.  
  57.  
  58. ; ***             L O O K U P    T A B L E    T Y P E S        ***
  59.  
  60. WSILookupSimpleArray            EQU        0                    ; a simple array indexed by glyph code 
  61. WSILookupSegmentSingle            EQU        2                    ; segment mapping to single value 
  62. WSILookupSegmentArray            EQU        4                    ; segment mapping to lookup array 
  63. WSILookupSingleTable            EQU        6                    ; sorted list of glyph, value pairs 
  64. WSILookupTrimmedArray            EQU        8                    ; a simple trimmed array indexed by glyph code 
  65. ; typedef unsigned short                 WSILookupTableFormat
  66.  
  67. ; typedef unsigned short                 WSILookupValue
  68.  
  69. ;  An offset from the beginning of the lookup table 
  70. ; typedef unsigned short                 WSILookupOffset
  71.  
  72. ;     FORMAT SPECIFIC DEFINITIONS 
  73. ;        lookupSimpleArray:
  74. ;        
  75. ;        This is a simple array which maps all glyphs in the font
  76. ;        to lookup values.
  77. ;    
  78.  
  79. WSILookupArrayHeader    RECORD 0
  80. lookupValues             ds.w    1                ; offset: $0 (0) <-- really an array of length one ;  The array of values indexed by glyph code 
  81. sizeof                     EQU *                    ; size:   $2 (2)
  82.                         ENDR
  83. ;        lookupTrimmedArray:
  84. ;        
  85. ;        This is a single trimmed array which maps a single range
  86. ;        of glyhs in the font to lookup values.
  87. ;    
  88.  
  89. WSILookupTrimmedArrayHeader RECORD 0
  90. firstGlyph                 ds.w    1                ; offset: $0 (0)
  91. limitGlyph                 ds.w    1                ; offset: $2 (2)
  92. valueArray                 ds.w    1                ; offset: $4 (4) <-- really an array of length one
  93. sizeof                     EQU *                    ; size:   $6 (6)
  94.                         ENDR
  95. ;  The format specific part of the subtable header 
  96. WSILookupFormatSpecificHeader RECORD 0
  97. simpleArray                 ds        WSILookupArrayHeader ; offset: $0 (0)    ;  rename lookupArray as simpleArray <9> 
  98.                          ORG 0
  99. trimmedArray             ds        WSILookupTrimmedArrayHeader ; offset: $0 (0)
  100. sizeof                     EQU *                    ; size:   $6 (6)
  101.                         ENDR
  102. ;  The overall subtable header 
  103. WSILookupTableHeader    RECORD 0
  104. format                     ds.w    1                ; offset: $0 (0)        ;  table format 
  105. fsHeader                 ds        WSILookupFormatSpecificHeader ; offset: $2 (2) ;  format specific header 
  106. sizeof                     EQU *                    ; size:   $8 (8)
  107.                         ENDR
  108.  
  109. ; ***        G L Y P H    E X P A N S I O N    ***
  110.  
  111.                                                             ; fixed 1.0 
  112. kCurrentGlyphExpansionVersion    EQU        $00010000
  113. ; typedef unsigned short                 GlyphExpansionFormats
  114.  
  115.  
  116. GlyphExpansionLookupFormat        EQU        1
  117. GlyphExpansionContextualFormat    EQU        2
  118. ExpandedGlyphCluster    RECORD 0
  119. numGlyphs                 ds.b    1                ; offset: $0 (0)
  120. bestGlyph                 ds.b    1                ; offset: $1 (1)
  121. glyphs                     ds.w    1                ; offset: $2 (2) <-- really an array of length one
  122. sizeof                     EQU *                    ; size:   $4 (4)
  123.                         ENDR
  124. ExpandedGlyphOffset        RECORD 0
  125. glyph                     ds.w    1                ; offset: $0 (0)
  126. offset                     ds.w    1                ; offset: $2 (2)        ;  offset to ExpandedGlyphCluster 
  127. sizeof                     EQU *                    ; size:   $4 (4)
  128.                         ENDR
  129. GlyphExpansionStateTable RECORD 0
  130. stateTableOffset         ds.w    1                ; offset: $0 (0)
  131. classTableOffset         ds.w    1                ; offset: $2 (2)
  132. actionTableOffset         ds.w    1                ; offset: $4 (4)        ;  state, class and actions tables follow here... 
  133. sizeof                     EQU *                    ; size:   $6 (6)
  134.                         ENDR
  135. GlyphExpansionTable        RECORD 0
  136. version                     ds.l    1                ; offset: $0 (0)
  137. format                     ds.w    1                ; offset: $4 (4)
  138. expansionNumer             ds.w    1                ; offset: $6 (6)
  139. expansionDenom             ds.w    1                ; offset: $8 (8)        ;  num/denom ratio for expansion <2> 
  140. stateTable                 ds        GlyphExpansionStateTable ; offset: $A (10)
  141.                          ORG 10
  142. lookup                     ds        WSILookupTableHeader ; offset: $A (10) ;  expanded glyph clusters follow here... 
  143. sizeof                     EQU *                    ; size:   $12 (18)
  144.                         ENDR
  145.  
  146. ;  Glyph-to-Character constants and types  
  147.  
  148. kCurrentGlyphToCharVersion        EQU        $00010100
  149. ; typedef unsigned short                 GlyphToCharLookupFormats
  150.  
  151.  
  152. kGlyphToCharLookup8Format        EQU        1
  153. kGlyphToCharLookup16Format        EQU        2
  154. kGlyphToCharLookup32Format        EQU        3
  155. ; typedef UInt8                         GlyphToCharFontIndex
  156.  
  157. ; typedef UInt8                         QDGlyphcode
  158.  
  159. GlyphToCharActionTable    RECORD 0
  160. fontNameOffset             ds.w    1                ; offset: $0 (0)        ;  offset relative to this table 
  161. actions                     ds        WSILookupTableHeader ; offset: $2 (2)    ;  only support lookupSimpleArray format for now 
  162. sizeof                     EQU *                    ; size:   $A (10)
  163.                         ENDR
  164. GlyphToCharActionHeader    RECORD 0
  165. numTables                 ds.w    1                ; offset: $0 (0)        ;  0..n 
  166. offsets                     ds.w    1                ; offset: $2 (2) <-- really an array of length one ;  offsets from start of action table header 
  167. sizeof                     EQU *                    ; size:   $4 (4)
  168.                         ENDR
  169. GlyphToCharHeader        RECORD 0
  170. version                     ds.l    1                ; offset: $0 (0)
  171. actionOffset             ds.w    1                ; offset: $4 (4)        ;  offset to GlyphToCharActionHeader 
  172. format                     ds.w    1                ; offset: $6 (6)        ;  size of font mask 
  173. mappingTable             ds        WSILookupTableHeader ; offset: $8 (8)
  174. sizeof                     EQU *                    ; size:   $10 (16)
  175.                         ENDR
  176.  
  177. ;  JUSTIFICATION TYPES
  178. ;    WorldScript supports justification of text using insertion. The justification
  179. ;    table specifies a insertion string to insert between 2 specified glyphs.
  180. ;    Each combination of inter-glyph boundary can be assigned a justification priority,
  181. ;    the higher the priority the more justification strings inserted at that position.
  182. ;    
  183. ;    The priorities for each inter-glyph boundary are specified by the justification table's
  184. ;    state table.
  185. ;    
  186. ;    Special handling is done for scripts which use spaces to justify, because the width of 
  187. ;    a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  188. ;    per inserting string is specified in the justification table.
  189. ;
  190. ;
  191.  
  192.  
  193.                                                             ; 1.0 not supported 
  194. kCurrentJustificationVersion    EQU        $0200
  195.  
  196. kJustificationStateTableFormat    EQU        1
  197.  
  198.                                                             ; WSI's internal limitation <12> 
  199. kMaxJustificationStringLength    EQU        13
  200. ; typedef UInt8                         WSIJustificationPriority
  201.  
  202.  
  203. WSIJustificationSetMarkMask        EQU        $80
  204. WSIJustificationStateEntry RECORD 0
  205. markPriority             ds.b    1                ; offset: $0 (0)        ;  non-zero priorities means insertion 
  206. priority                 ds.b    1                ; offset: $1 (1)
  207. newState                 ds.w    1                ; offset: $2 (2)
  208. sizeof                     EQU *                    ; size:   $4 (4)
  209.                         ENDR
  210. ; typedef unsigned short                 WSIJustificationClasses
  211.  
  212.  
  213. wsiJustEndOfLineClass            EQU        0
  214. wsiJustEndOfRunClass            EQU        1
  215. wsiJustDeletedGlyphClass        EQU        2
  216. wsiJustUserDefinedClass            EQU        3
  217. ; typedef unsigned short                 WSIJustificationStates
  218.  
  219.  
  220. wsiStartOfLineState                EQU        0                    ; pre-defined states 
  221. wsiStartOfRunState                EQU        1
  222. wsiUserDefinedState                EQU        2
  223. ;  pre-multiplied: class# * sizeof(WSIJustificationStateEntry) 
  224. ; typedef UInt8                         WSIJustificationClassOffset
  225.  
  226. WSIJustificationStateTable RECORD 0
  227. maxPriorities             ds.w    1                ; offset: $0 (0)
  228. rowWidth                 ds.w    1                ; offset: $2 (2)        ;  width of a state table row in bytes 
  229. classTableOffset         ds.w    1                ; offset: $4 (4)
  230. stateTableOffset         ds.w    1                ; offset: $6 (6)
  231. sizeof                     EQU *                    ; size:   $8 (8)
  232.                         ENDR
  233. ;            Last two fields of above structure - someday?
  234. ;            WSIJustificationClassOffset    classes[up to 64 classes supported];
  235. ;            WSIJustificationStateEntry    states[up to your heart's desire];
  236. ;        
  237.  
  238. WSIJustificationHeader    RECORD 0
  239. version                     ds.w    1                ; offset: $0 (0)
  240. format                     ds.w    1                ; offset: $2 (2)
  241. scaling                     ds        Point            ; offset: $4 (4)        ;  numer/denom scaling of priority weights <7> 
  242. spacesPerInsertion         ds.w    1                ; offset: $8 (8)        ;  # of $20 chars in justification insertion string <12> 
  243. justStringOffset         ds.w    1                ; offset: $A (10)        ;  offset to justification string 
  244. stateTable                 ds        WSIJustificationStateTable ; offset: $C (12) ;  long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows 
  245. sizeof                     EQU *                    ; size:   $14 (20)
  246.                         ENDR
  247.  
  248. ;  Line Layout's Property table version <11> 
  249.  
  250.                                                             ; v1.0 
  251. currentPropsTableVersion        EQU        $00010000
  252.  
  253.                                                             ; version is octal 0100 or hex 0x40 (#64) 
  254. kCharToGlyphCurrentVersion        EQU        $40
  255. ;  pass as priorityWeight to JustifyWSILayout to use script's current just setting 
  256.  
  257. kScriptsDefaultJustWeight        EQU        -1
  258.  
  259. ;  feature selectors used in FindScriptRun and itl5 configuration tables <9> 
  260. ; typedef UInt16                         WSIFeatureType
  261.  
  262. ; typedef UInt16                         WSIFeatureSelector
  263.  
  264. WSIFeature                RECORD 0
  265. featureType                 ds.w    1                ; offset: $0 (0)
  266. featureSelector             ds.w    1                ; offset: $2 (2)
  267. sizeof                     EQU *                    ; size:   $4 (4)
  268.                         ENDR
  269.     ENDIF ; __WORLDSCRIPT__ 
  270.  
  271.